import { createRouter, createWebHistory } from 'vue-router'

// 懒加载视图
const Home = () => import('../views/Home.vue')
const CaseManagement = () => import('../views/CaseManagement.vue')
const ReportView = () => import('../views/ReportView.vue')
const TestFunctionReport = () => import('@/components/FunctionalReport.vue')
const TestBenchMarkReport = () => import('@/components/BenchmarkReport.vue')

const routes = [
  { path: '/', component: Home, name: 'Home' },
  { path: '/cases', component: CaseManagement, name: 'Cases' },
  {
    path: '/reports',
    name: 'Reports',
    component: ReportView,
  },
  {
    path: '/reports/detail/:id', // ✅ 关键：不要以 / 开头！
    name: 'FunctionalReport',
    component: TestFunctionReport,
  },
]

export const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})
